<?php

class Application_Form_ItemlistingEdit extends Zend_Form
{

	public function init()
	{
		
		$this->setDecorators(array(
		
				array('ViewScript', array(
						// the view template script
						'viewScript' => 'forms/itemlisting.phtml'))
		));
		
		
		
		$this->setMethod('post');
		$this->setAction('/itemlisting/edit');
		
		$id = new Zend_Form_Element_Hidden('id');

			$inventoryItem = new Zend_Form_Element_Text('inventoryItem');
		$inventoryItem->setLabel('Inventory Item');
		$inventoryItem->setRequired(true);
		$inventoryItem->setAttrib('size', '10');
		
		$eanCode = new Zend_Form_Element_Text('eanCode');
		$eanCode->setLabel('EAN');
		$eanCode->setRequired(true);
		
		$inventoryItemDesc = new Zend_Form_Element_Text('inventoryItemDesc');
		$inventoryItemDesc->setLabel('Item Description');
		$inventoryItemDesc->setAttrib('size', '50');
		$inventoryItemDesc->setAttrib('readonly', 'readonly');
		$inventoryItemDesc->setIgnore(true);
		
		$pricelistDesc = new Zend_Form_Element_Text('pricelistDesc');
		$pricelistDesc->setLabel('Item Description (appears on pricelist)');
		$pricelistDesc->setRequired(true);
		$pricelistDesc->setAttrib('size', '50');
		
		$skylanderWave = new Zend_Form_Element_Text('skylandersWave');
		$skylanderWave->setLabel('Skylander Wave (optional)');
		$skylanderWave->setAttrib('size', '10');
		
		$platform = new Zend_Form_Element_Text('platform');
		$platform->setLabel('Platform');
		$platform->setRequired(true);
		
		$divisionDesc = new Zend_Form_Element_Text('divisionDesc');
		$divisionDesc->setLabel('Division');
		$divisionDesc->setRequired(true);
		
		$categoryType = new Zend_Form_Element_Text('categoryType');
		$categoryType->setLabel('Category');
		$categoryType->setRequired(true);
		$categoryType->setAttrib('readonly', 'readonly');
		
		$releaseDate = new ZendX_JQuery_Form_Element_DatePicker('releaseDate', array('jQueryParams' => array('dateFormat' => 'yy-mm-dd')));
		$releaseDate->setLabel('ReleaseDate');
		$releaseDate->setRequired(true);
		
		$language = new Zend_Form_Element_Text('language');
		$language->setLabel('Language');
		
		$hek = new Zend_Form_Element_Text('hek');
		$hek->setLabel('HEK');

		$hek->setAttrib('size', '10');
		
		$hekCH = new Zend_Form_Element_Text('hekCH');
		$hekCH->setLabel('HEK CH');

		$hekCH->setAttrib('size', '10');
		
		$srp = new Zend_Form_Element_Text('srp');
		$srp->setLabel('SRP');
		$srp->setAttrib('size', '10');
		
		$usk = new Zend_Form_Element_Select('uskRating');
		$usk->addMultiOptions(array('0' => '0', '6' => '6', '12' => '12', '16' => '16', '18' => '18'));
		$usk->setLabel('USK Rating');
		
		$pegi = new Zend_Form_Element_Select('pegiRating');
		$pegi->addMultiOptions(array('3' => '3', '7' => '7', '12' => '12', '16' => '16', '18' => '18'));
		$pegi->setLabel('PEGI Rating');

		$carton = new Zend_Form_Element_Text('unitCarton');
		$carton->setLabel('Units per carton');
		$carton->setAttrib('size', '10');

		$pallet = new Zend_Form_Element_Text('unitPallet');
		$pallet->setLabel('Units per pallet');
		$pallet->setAttrib('size', '10');
		
		$weight = new Zend_Form_Element_Text('weight');
		$weight->setLabel('Weight (g)');
		$weight->setAttrib('size', '10');
		
		$dimension = new Zend_Form_Element_Text('dimensions');
		$dimension->setLabel('Dimensions (H/W/D)');
		$dimension->setAttrib('size', '20');
		
		$countryOfOrigin = new Zend_Form_Element_Text('countryOfOrigin');
		$countryOfOrigin->setLabel('Country of Origin');
		$countryOfOrigin->setAttrib('size', '10');
		
		$mshNumber = new Zend_Form_Element_Text('mshNumber');
		$mshNumber->setLabel('MSH item number');
		$mshNumber->setAttrib('size', '20');
		
		$msbNumber = new Zend_Form_Element_Text('msbNumber');
		$msbNumber->setLabel('MSH Austria item number');
		$msbNumber->setAttrib('size', '20');
		
		$toysNumber = new Zend_Form_Element_Text('toysNumber');
		$toysNumber->setLabel('Toys\'R\'us item number');
		$toysNumber->setAttrib('size', '20');
		
		$lastOrderDate = new ZendX_JQuery_Form_Element_DatePicker('lastOrderDate', array('jQueryParams' => array('dateFormat' => 'yy-mm-dd')));
		$lastOrderDate->setLabel('Last Order D1');
				
		$listedOnDate = new ZendX_JQuery_Form_Element_DatePicker('listedOnDate', array('jQueryParams' => array('dateFormat' => 'yy-mm-dd')));
		$listedOnDate->setLabel('Listed on');

		
		$listedOutDate = new ZendX_JQuery_Form_Element_DatePicker('listedOutDate', array('jQueryParams' => array('dateFormat' => 'yy-mm-dd')));
		$listedOutDate->setLabel('Listed out on');
				
		$lastReturnDate = new ZendX_JQuery_Form_Element_DatePicker('lastReturnDate', array('jQueryParams' => array('dateFormat' => 'yy-mm-dd')));
		$lastReturnDate->setLabel('Last Return Date:');
		
		$lastDefectiveDate = new ZendX_JQuery_Form_Element_DatePicker('lastDefectiveDate', array('jQueryParams' => array('dateFormat' => 'yy-mm-dd')));
		$lastDefectiveDate->setLabel('Last Defective Date:');
		
		$active = new Zend_Form_Element_Select('active');
		$active->addMultiOptions(array('Y' => 'Y', 'N' => 'N'));

		$active->setLabel('Active');
		$active->setRequired(true);
		
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setLabel('UpdateItem');

		$this->addElements(array($inventoryItem, $eanCode,$inventoryItemDesc, $pricelistDesc, $platform, $divisionDesc, 
									$categoryType, $releaseDate, $language, $hek, $hekCH, $usk, $pegi, $carton, $pallet,
									$weight, $dimension, $countryOfOrigin, $mshNumber, $msbNumber, $toysNumber, $skylanderWave, 
									$lastOrderDate, $srp,$listedOnDate, $listedOutDate, $lastReturnDate, $lastDefectiveDate, $active, $id, $submit));
		
		//Enable Zend form inputboxes and error output
		$this->setElementDecorators(array('ViewHelper', 'Errors'));
		
		//trigger Widget decorator for Datepicker
		$this->getElement('releaseDate')->setDecorators(array('UiWidgetElement', 'Errors'));
		$this->getElement('lastOrderDate')->setDecorators(array('UiWidgetElement', 'Errors'));
		$this->getElement('listedOnDate')->setDecorators(array('UiWidgetElement', 'Errors'));
		$this->getElement('listedOutDate')->setDecorators(array('UiWidgetElement', 'Errors'));
		$this->getElement('lastReturnDate')->setDecorators(array('UiWidgetElement', 'Errors'));
		$this->getElement('lastDefectiveDate')->setDecorators(array('UiWidgetElement', 'Errors'));
	}


}
